import axios from "axios";
import { showMessage } from "@/utils";

//创建一个axios实例
const ins = axios.create();

//添加响应拦截器
ins.interceptors.response.use(function (response) {
	//判断当前信息是否错误
	if (response.data.code !== 0) {
		showMessage({
			content: response.data.msg,
			type: "warn",
		});
		return null;
	}

	return response.data.data;
});
export default ins;
